home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dodge.swf / scripts / __Packages / CustomMath.as next >
Encoding:
Text File  |  2011-10-17  |  684 b   |  28 lines

  1. class CustomMath
  2. {
  3.    function CustomMath()
  4.    {
  5.    }
  6.    static function degToRad(n)
  7.    {
  8.       return 3.141592653589793 * n / 180;
  9.    }
  10.    static function radToDeg(n)
  11.    {
  12.       return n * 180 / 3.141592653589793;
  13.    }
  14.    static function isInStage(mc)
  15.    {
  16.       return !(mc._x < -50 || mc._x > Stage.width + 50 || mc._y < -50 || mc._y > Stage.height + 50);
  17.    }
  18.    static function getAngleToPlayer(x, y)
  19.    {
  20.       return CustomMath.radToDeg(Math.atan2(_root.player.getCoords().y - y,_root.player.getCoords().x - x));
  21.    }
  22.    static function randomRange(min, max)
  23.    {
  24.       var _loc1_ = max - min;
  25.       return Math.random() * (_loc1_ + 1) + min;
  26.    }
  27. }
  28.